//
//  ArticleManager.h
//  iCarStyle
//
//  Created by liunian on 13-9-10.
//  Copyright (c) 2013年 liunian. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ReqObject.h"
#import "HtmlHelper.h"

@class Article;
@class NewsEntity;
@class SinglePic;
@protocol ArticleManagerDelegate <NSObject>

@optional
- (void)mkManagerDidFinishedWithFavArticles:(NSMutableArray *)articles;
@end

#if NS_BLOCKS_AVAILABLE
typedef void (^ReqBlock)(ReqObject *reqObject);
typedef void (^NewsReqBlock)(ReqObject *reqObject);
#endif

@interface ArticleManager : NSObject
@property (nonatomic, retain) NSMutableArray *favorites;
@property (nonatomic, assign) id<ArticleManagerDelegate>delegate;

+ (ArticleManager *)sharedManager;
- (void)addObserver:(id<ArticleManagerDelegate>)observer;
- (void)removeObserver:(id<ArticleManagerDelegate>)observer;

- (void)insertArticle:(Article *)article;

- (void)insertPicture:(PicModel *)picture;
- (void)insertSinglePic:(SinglePic *)singlePic;
- (NSArray *)singlePicsForPicture:(PicModel *)picture;

//此方法为程序后台运行缓存各个栏目10页内容
- (void)cacheTenpages;
//刷新数据
- (void)reloadNewsWithReqObject:(ReqObject *)object itemsBlock:(ItemsBlock)block;
- (void)reloadPicListReqObject:(ReqObject *)req itemsBlock:(ItemsBlock)block;

- (void)reloadPicListReqObject:(ReqObject *)req itemsBlock:(ItemsBlock)block updateItemBlock:(ItemsBlock)updateBlock;

- (BOOL)isCache;
- (void)setCache:(BOOL)cacheFinish;
- (BOOL)isFirstLaunch;
- (void)setFirstLaunch:(BOOL)firstLaunch;

- (void)insertLink:(NSString *)link;

- (BOOL)isTodayClick;
- (void)setTodayClick:(BOOL)todayClick;

//收藏
- (void)getArticles;
- (BOOL)isFavArticle:(Article *)article;
- (void)favArticle:(Article *)article;
- (void)cancelFavArticle:(Article *)article;
@end
